home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
0022-3.564
/
dmg-0139
/
news.txt
/
letters.asc
< prev
next >
Wrap
Text File
|
1997-04-16
|
5KB
|
133 lines
LETTERS
=======
Hi Dave,
How the time flies......it seems like only yesterday that summer
was just about to start and STen 4 was the latest thing on the market and
now the evenings are drawing in and......but enough of this rubbish. Have
enclosed three discs for later versions. Do not wish to go over the top
but I look forward to future editions! Have stuck in a couple of extra
stamps.
Regards,
John Corbett
~~~OOOO~~~
Dear Dave,
Thank you for speedily sending me your disk magazine. I think
its excellent, keep up the good work!
I'm writing to you because I want to obtain back issue's of your magazine.
I don't know how many there are but if you can send me information on how
many disks to send + postage fee I would be grateful!
Yours,
Lee Hughes
Lee,
we now are on the eighth issue of STEN, numbered 0 -7. I'm presently
reworking the old issues to take advantage of the new shell. They are all
available from myself, John, Mick or Dave Cowling. All you need to send is
the correct number of discs and a stamped-self-addressed-envelope.
Dave
~~~OOOO~~~
Dear Dave,
I hope you can help me. In a recent copy of ST FORMAT, Oct 1991,
there was a technical article on GFA programming. The author gave some
examples of disc input and output. I have tried to use the routine to load
a file of any size into memory with some success. It works sometimes and
not others, what am I doing wrong? I have included the program with my
disk for the next issue of STEN.
Yours sincerely,
Tom Nicholson
Tom,
the program that you sent (see below) is one that I have seen often. I
don't know if this is a genuine problem area or one that the author has
simply copied from another source and not bothered to check if it really
works.
The problem is in reading files into memory for future manipulation. The
article in question opens the file and determines its length using
LOF(#1), nothing wrong so far. It then creates a string of the required
length, into which, to load the program.
This is where the routine falls apart. In GFA BASIC it is not possible to
have a string longer than 32767 bytes. So, if the file you are trying to
load is larger than this your program will crash.
The ST Format routine:
----------------------
To load an unknown sized block off(sic) data into A$, you would use:
OPEN "I", #1, "A:TEST2.DAT" !Open the file
L=LOF(#1) !How many bytes long is it?
CLOSE #1 !Close the file
A$=SPACE$(L) !Create empty string L bytes long
BLOAD "filename",Varptr(A$),L !Zap it into memory
Which is a load of bollocks, it will only work for files of length less
than 32768 bytes.
------
The answer is to dimension an interger array, which can be any size. This
is done by dimensioning an integer array using the length of the file
previously found, you have to divide the length by 4 as an integer is 4
bytes long.
The ammended routine will now read in any size of file if there is enough
memory available.
The amended routine:
---------------------
To really load an unknown sized block of data into a variable, you'd use:
OPEN "I", #1, "filename" !Open the file
L=LOF(#1) !How many bytes long is it?
CLOSE #1 !Close the file
ERASE A%() !This lets you use the routine more
!than once
DIM A%(L/4) !Create space in memory for file
BLOAD "filename",VARPTR(A%(0)),L !Load it into memory
Which works for files of any size.
~~~OOOO~~~
Dear Dave,
I really liked the last issue of STEN. In the article on ST
variables the author said that if anyone was interested he would write
further articles.
I'm interested, would you let him know as I would like to find out more
about the subject.
Best wishes,
Jack Warburton
Jack,
I'm afraid that article came from the public domain and I wouldn't
have a clue as how to contact the author. If he's reading this, please get
in touch as I'm sure quite a few people would like to know more.
~~~OOOO~~~